package 面向对象作业.面向对象2;

public class Person {
    private double height;
    private double weight;

    public Person(double height, double weight) {
        this.height = height;
        this.weight = weight;
    }

    public Person() {
        double random = Math.random() * 100;
        if (random >= 140 && random <= 200) {
            this.height = random;
        }
        double random1 = Math.random() * 160;
        if (random1>=50&&random1<=160){
            this.weight=random1;
        }

    }

    public double getHeight() {
        return height;
    }

    public void setHeight(double height) {
        this.height = height;
    }

    public double getWeight() {
        return weight;
    }

    public void setWeight(double weight) {
        this.weight = weight;
    }

    @Override
    public String toString() {
        return "Person{" +
                "height=" + height +"cm"+
                ", weight=" + weight +"kg"+
                '}';
    }
    public   String   panDuan(){
        String   f;
        double v = weight / (height - 105);
        if (v>0.9||v<1.1){
            f="正常";
        }else if (v<0.9){
            f="偏瘦";
        }else {
            f="偏重";
        }
        return   f;
    }
}